package com.charzhan.five;

import com.charzhan.utiles.rabbitmqutil;
import com.rabbitmq.client.Channel;
import com.sun.javafx.iio.common.ImageLoaderImpl;

import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/*

send message

 */
public class prudce  {
    public static final String EXCHANGE_NAME="logs";
    public static void main(String[] args) throws Exception {

        Channel channel = rabbitmqutil.getChannel();
        channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String next = scanner.next();
            channel.basicPublish(EXCHANGE_NAME,"",null,next.getBytes(StandardCharsets.UTF_8));
            System.out.println("send succes");
        }
    }
}
